<?php

namespace App\Http\Controllers\Vue;

use App\Http\Controllers\Controller;
use Jinxing\Admin\Repositories\Nav\NavTypeRepository;

/**
 * Class NavController 导航分类
 *
 * @package App\Http\Controllers\Vue
 */
class NavController extends Controller
{
    /**
     * @var NavTypeRepository
     */
    private $navTypeRepository;

    public function __construct(NavTypeRepository $navTypeRepository)
    {
        $this->navTypeRepository = $navTypeRepository;
    }

    public function index()
    {
        // 查询主要类目信息
        return $this->success($this->navTypeRepository->find(
            request()->get('type_id'),
            [
                'type_id', 'name', 'description',
                'navInfo' => [
                    'id', 'parent_id', 'name', 'url', 'icon', 'target', 'type_id'
                ]
            ]
        ));
    }
}
